﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.BasicData.DTO;
using PowerHub.MES.DTO.BasicData.QueryDto;
using PowerHub.MES.DTO.Shopfloor.DTO;
using PowerHub.MES.DTO.Shopfloor.QueryDTO;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.Entities.Shopfloor;
using PowerHub.MES.IServices.IBasic;
using PowerHub.MES.IServices.IShopfloor;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Workshopinfo
{

    /// <summary>
    /// 车间
    /// </summary>
    [ApiController]
    [Route("Api/MES/Shopfloor/[controller]/[action]")]
    public class WorkshopinfoController
    {

        private IShopfloor_WorkshopinfoServices _shopfloor_WorkshopinfoServices;

        public WorkshopinfoController(IShopfloor_WorkshopinfoServices WorkshopinfoServices)
        {
            _shopfloor_WorkshopinfoServices = WorkshopinfoServices;
        }

        /// <summary>
        /// 获取车间列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取车间列表")]
        public async Task<OperationPageResult<List<Shopfloor_Workshopinfo>>> GetShopfloor_WorkshopinfoPageListAsync([FromBody] QueryShopfloor_WorkshopinfoDTO pageQuery)
        {
            return await _shopfloor_WorkshopinfoServices.GetShopfloor_WorkshopinfoPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除车间
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除车间")]
        public async Task<OperationResult<object>> DeletionShopfloor_WorkshopinfoAsync([FromBody] List<string> Query)
        {
            return await _shopfloor_WorkshopinfoServices.DeletionShopfloor_WorkshopinfoAsync(Query);
        }

        /// <summary>
        /// 更新车间
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新车间")]
        public async Task<OperationResult<object>> UpdateShopfloor_WorkshopinfoAsync([FromBody] Shopfloor_WorkshopinfoDTO Query)
        {
            return await _shopfloor_WorkshopinfoServices.UpdateShopfloor_WorkshopinfoAsync(Query);
        }

        /// <summary>
        /// 添加车间
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加车间")]
        public async Task<OperationResult<object>> CreateShopfloor_WorkshopinfoAsync([FromBody] Shopfloor_WorkshopinfoDTO Query)
        {
            return await _shopfloor_WorkshopinfoServices.CreateShopfloor_WorkshopinfoAsync(Query);
        }
    }
}
